package com.a2j.exception;

import com.a2j.beans.base.code.ResponseCode;

/**
 * Author: bzb
 * Data: 2021/9/1 23:47
 * Desc: 业务异常
 */
public class BizException extends RuntimeException{

    protected int errorCode;
    protected String errorMessage;

    public BizException() {
        super();
    }

    public BizException(ResponseCode responseCode) {
        super(responseCode.getMessage());
        this.errorCode = responseCode.getCode();
        this.errorMessage = responseCode.getMessage();
    }

    public BizException(int errorCode, String errorMessage) {
        super();
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    @Override
    public String getMessage() {
        return super.getMessage() + ", errorCode：" + errorCode + ", errorMsg：" + errorMessage;
    }
}
